<!DOCTYPE html>
<html xmlns=http://www.w3.org/1999/xhtml xmlns:bd=http://www.baidu.com/2010/xbdml>
<head>
    <meta http-equiv="Content-Type" content="text/html" charset="utf-8">
    <title>NB设备</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/pc/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/pc/layout/css/font_eolqem241z66flxr.css" media="all" />
    <link rel="stylesheet" href="/pc/layout/css/news.css" media="all" />
    <style type="text/css">
    th{
        width:7.14%;
    }
    </style>
</head>
<body class="childrenBody">
<blockquote class="layui-elem-quote news_search" style="margin-top:1.2em;">
    <div class="layui-inline">
        <div class="layui-input-inline">
            <input type="text" value="" placeholder="请输入关键字" class="layui-input search_input">
        </div>
        <a class="layui-btn search_btn">查询</a>
    </div>
    <div class="layui-inline">
        <a class="layui-btn linksAdd_btn" style="background-color:#5FB878">添加</a>
    </div>
</blockquote>
<div class="layui-form links_list">
    <table class="layui-table">
     {{csrf_field()}}
        <thead>
        <tr>
            <th style="width: 3%;">ID</th>
            <th>VerifyCode</th>
            <th>DeviceId</th>
            <th>Psk</th>
            <th>TimeOut</th>
            <th>AddTime</th>
            <th>Name</th>
            <th>DeviceType</th>
            <th>ManufacturerId</th>
            <th>ManufacturerName</th>
            <th>Model</th>
            <th>ProtocolType</th>
            <th>Updatetime</th> 
            <th>Handle</th>
        </tr>
        </thead>
        <tbody class="links_content">
        @if(!empty($data))
            @foreach($data as $val)
        <tr id="nbd_{{$val['id']}}">
            <td>{{$val['id']}}</td>
            <td>{{$val['verifyCode']}}</td>
            <td>{{$val['deviceId']}}</td>
            <td>{{$val['psk']}}</td>
            <td>{{$val['timeout']}}</td>
            <td>{{$val['addtime']}}</td>
            <td>{{$val['name']}}</td>
            <td>{{$val['deviceType']}}</td>
            <td>{{$val['manufacturerId']}}</td>
            <td>{{$val['manufacturerName']}}</td>
            <td>{{$val['model']}}</td>
            <td>{{$val['protocolType']}}</td>
            <td>{{$val['updatetime']}}</td>
            <td>
                <a class="layui-btn layui-btn-mini links_edit" type="{{$val['id']}}"><i class="iconfont icon-edit"></i> 编辑</a>
                <a class="layui-btn layui-btn-danger layui-btn-mini links_del" data-id="1" onclick="delNbdev({{$val['id']}})"><i class="layui-icon"></i> 删除</a>
            </td>
        </tr>
            @endforeach
        @endif
        </tbody>
    </table>
</div>
<script type="text/javascript" src="/pc/layout/js/jquery.min.js"></script>
<script type="text/javascript" src="/pc/layui/layui.js"></script>
<script type="text/javascript" src="/NB/nbdev/js/nbdev.js"></script>
<script>
         function delNbdev(id){  //删除
        layer.confirm('确定删除此信息？',{icon:3, title:'提示信息'},function(index){
            $.ajax({
                url:'/nb/common/nbdev/destroy',
                type:'post',
                async:false,
                data:{
                    "_token": $("input[name=_token]").val(),
                    'id':id
                },
                dataType:'json',
                success:function (data) {
                    if(data.status == 1){
                        $('#nbd_'+id).remove();
                        layer.msg('删除成功！',{time:800});
                         // parent.location.reload();
                         layer.close(index);
                    }
                }
            })
            layer.close(index);
        });
    }
</script>
</body>
</html>